﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

class CControlPressButton
{
    KeyboardState keyBoard;
    KeyboardState lastKeyBoard;
    bool b_AnPhim = false;
    private int i_SelectButton = 0;

    public int selectButton(int i_SelectButton)
    {
        lastKeyBoard = keyBoard;
        keyBoard = Keyboard.GetState();
        b_AnPhim = false;
        this.i_SelectButton = i_SelectButton;
        if ((lastKeyBoard.IsKeyUp(Keys.Down)) & (keyBoard.IsKeyDown(Keys.Down)))
        {
            i_SelectButton += 1;
            b_AnPhim = true;
        }
        if (lastKeyBoard.IsKeyUp(Keys.Up) & (keyBoard.IsKeyDown(Keys.Up)))
        {
            i_SelectButton -= 1;
            b_AnPhim = true;
        }
        if (i_SelectButton < 0)
            i_SelectButton = 5;
        if (i_SelectButton > 5)
            i_SelectButton = 0;
        return i_SelectButton;
    }
    public void Update(Game game)
    {
        if ((i_SelectButton == 5) & (lastKeyBoard.IsKeyDown(Keys.Enter)))
            game.Exit();
        if ((i_SelectButton == 0) & (lastKeyBoard.IsKeyDown(Keys.Enter)))
            CManager.Show = 1;
    }
    public bool Check(bool b_TrangThai)
    {
        if (b_AnPhim == true)
            b_TrangThai = true;
        return b_TrangThai;
    }
}

